//
//  CoreManager.m
//  Project
//
//  Created by Suny on 14-8-11.
//  Copyright (c) 2014年 Suny. All rights reserved.
//

#import "CoreManager.h"
#import "NSString+BaseFramework.h"
#import "BaseDefines.h"

@implementation CoreManager

DEF_SINGLETON();

- (id)init
{
	if (self = [super init])
	{
		self.cacheManager = [[BaseCacheManager alloc] init];
		self.appInfo = [AppInfo loadObjectFromFileWithFileName:@"AppInfo" withPath:nil];
		if (!self.appInfo)
		{
			self.appInfo = [[AppInfo alloc] init];
		}
		self.appInfo.totalLoginNumber++;
        if ([self.appInfo firstOpenApp])
        {
            self.appInfo.currentLoginNumber = 1;
        }
        else
        {
            self.appInfo.currentLoginNumber ++;
        }

		[self initNetwork];
    }
	return self;
}


- (void)initNetwork
{
	[NetManager sharedInstance];
}

- (void)save
{
    if ([self.appInfo firstOpenApp])
    {
        self.appInfo.configVersion = kAppVersion;
    }
	[self.appInfo saveToFileWithFileName:@"AppInfo" withPath:nil];
}


- (void)dealloc
{
}
@end
